const apiRoute = require("./routes.js") // 接口路由名称
const lib = require("./lib.js") // api库
const customApi = require("./custom-api.js") // 特殊的路由实现
const Enum = require("./enum.js")

module.exports = {
  ...defaultApi(),
  ...customApi,
  ...lib,

  Enum,
}

// 默认的路由实现
function defaultApi() {
  let api = {}
  for (let route in apiRoute) {
    api[route] = (postData) => {
      return lib.ax(apiRoute[route], postData)
    }
  }
  return api
}
